<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('角色列表')" />
</head>
<body class="gray-bg">
	<div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="role-form">
					<div class="select-list">
						<ul>
							<li>
								所属区域：
								<select id="pr">
									<option value="0">请选择</option>
									<option th:each="pr:${prs}" th:value="${pr.provId}" th:text="${pr.provName}"></option>
								</select>
								<select id="city" name="sysCityId">
								</select>
							</li>
							<li>
								仓库名称：<input type="text" name="wareName"/>
							</li>
							<li class="select-time">
								<label>时间：</label>
								<input type="text" class="time-input" id="startTime" placeholder="最早时间"
									   name="params[beginTime]"/>
								<span>-</span>
								<input type="text" class="time-input" id="endTime" placeholder="最晚时间"
									   name="params[endTime]"/>
								</li>
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
	        
	        <div class="col-sm-12 select-table table-striped">
			    <table id="bootstrap-table"></table>
			</div>
		</div>
	</div>
	<th:block th:include="include :: footer" />
	<script th:inline="javascript">
		// var editFlag = [[${@permission.hasPermi('storage:ware:edit')}]];
		// var removeFlag = [[${@permission.hasPermi('storage:ware:remove')}]];
		var prefix = ctx + "statis/Ck";
		

		$(function() {
		    var options = {
				url: prefix + "/list",
				// detailUrl: prefixa + "/details/{id}",
				detailUrl: prefix + "/details/{id}",
		        // updateUrl: prefix + "/edit/{id}",
		        // removeUrl: prefix + "/remove",
		        modalName: "仓库",
		        columns: [{
		            checkbox: true
		        },
					{
						title: "序号",
						formatter: function (value, row, index) {
							return $.table.serialNumber(index);
						}
					},
		        {    field: 'repoWareId',
					title: "序号",
					visible: false,
		        },
		        {
		            field: 'ckwareName',
		            title: '仓库名称',
		        },
		        {
		            field: 'sysChargeUser',
		            title: '负责人',
		        },
				{
					field: 'cityName',
					title: '所属区域',

				},
				{
					field: 'ckstauscount',
					title: '出库数量',

				},
				{
					field: 'totalMoney',
					title: '金额',
					formatter: function (value, row, index) {
						return '￥'+value;
					}
				},
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	if (row.repoWareId!= null) {
							var action = [];
							action.push('<a class="btn btn-success btn-sm" style="margin-right: 5px" onclick="$.operate.detailTab('+ row.repoWareId +')">查看详情</a>');
		                    return action.join('');
		            	} else {
		                    return "";
		                }
		            }
		        }]
		    };
		    $.table.init(options);
		});

		// function isAble(op,id) {
		// 	$.ajax({
		// 		cache : true,
		// 		type : "POST",
		// 		url : ctx + "storage/ware/editStatus",
		// 		data : {
		// 			"wareId": id,
		// 			"repoStatus": op
		// 		},
		// 		async : false,
		// 		error : function(request) {
		// 			$.modal.alertError("系统错误");
		// 		},
		// 		success : function(data) {
		// 			$.operate.successCallback(data);
		// 		}
		// 	});
		// }

		$("#pr").change(function () {
			$.get("/statis/Ck/city/" + $("#pr").val(),{},function (data) {
				let options = '';
				for (let i = 0; i < data.length; i++) {
					options += '<option value="'+ data[i].cityId +'">'+ data[i].cityName +'</option>'
				}

				$("#city").html(options);
			})
		})
	</script>
</body>
</html>